<template>
	<view>
		<nav-bar bgColor="#3B5DE0" backState="2000" fontColor="#FFFFFF" title="我的"></nav-bar>
		<view class="nameBox">
			<view style="width: 90%;margin: 0 auto;height: 150rpx;display: flex;">
				<view style="line-height: 150rpx;">
					<image src="../../static/img/profile-photo.png"
						style="height: 100rpx;width: 100rpx;margin-top: 25rpx;"></image>
				</view>
				<view style="margin-left: 30rpx;margin-top: 30rpx;color: #FFFFFF;">
					<view style="font-size: 40rpx;font-weight: bold;">{{customerName}}</view>
					<view style="margin-top: 10rpx;font-size: 28rpx;display: flex;">
						<view style="height: 50rpx;line-height: 50rpx;">{{userName}}</view>
						<view style="margin-left: 30rpx;height: 50rpx;text-align: center;line-height: 50rpx;border-radius: 25px;font-size: 25rpx;background: #55aaff;min-width: 150rpx;">{{userType == '个体工商户' ? '个体工商户' : '企业'}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="topBox">
			<view class="bottomtBox">
				<view class="order-section">
					<view class="order-item" @click="myLimit" hover-class="common-hover" :hover-stay-time="50">
						<image src="../../static/icon/iconIndex/product.png"></image>
						<text>我的产品</text>
					</view>
					<view class="order-item" @click="rongziList" hover-class="common-hover" :hover-stay-time="50">
						<image src="../../static/icon/iconIndex/rongzi.png"></image>
						<text>融资列表</text>
					</view>
					<view class="order-item" @click="partner" hover-class="common-hover" :hover-stay-time="50">
						<image src="../../static/icon/iconIndex/maoyihuoban.png"></image>
						<text>贸易伙伴</text>
					</view>
				</view>
			</view>
		</view>
		<view>
			<uni-list style="width: 90%;margin: 0 auto;border-radius: 15rpx;">
				<view>
					<!-- <uni-list-item @click="account" thumb="../../static/icon/iconIndex/zhanghuguanli.png" title="账户管理" link="reLaunch" clickable></uni-list-item> -->
					<!-- <uni-list-item   thumb="../../static/icon/iconIndex/maoyihuoban.png" title="贸易伙伴" link="reLaunch" clickable></uni-list-item> -->
					<uni-list-item @click="resourceClick" thumb="../../static/icon/tab/products-select.png" title="资源管理" link="reLaunch" clickable></uni-list-item>
					<uni-list-item @click="handlePayBack" thumb="../../static/icon/tab/payback.png" title="去还款" link="reLaunch" clickable></uni-list-item>
				</view>
			</uni-list>
		</view>
		<button class="button_fix" size="default" @click="logout">退出</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userName: '',
				customerName: '',
				userType: '',
				version: '',
				num: ''
			}
		},
		onLoad() {
			this.userName = uni.getStorageSync('userInfo').nickName
			this.userType = uni.getStorageSync('userInfo').userType
			this.version = plus.runtime.version
		},
		onShow() {
			this.getUserInfo();
		},
		methods: {
			account(){
				uni.navigateTo({
					url:'/pages/resource/account'
				})
			},
			handlePayBack(){
				uni.navigateTo({
					url:'/pages/login/jdLogin'
				})
			},
			partner(){
				uni.navigateTo({
					url:'/pages/resource/partner'
				})
			},
			getUserInfo() {
				let opt = {
					url: 'basic/customer/getMyCustInfor',
					method: 'POST'
				};
				this.$http.httpTokenRequest(opt, {}).then(res => {
					if (res.data.code == 200) {
						this.num = res.data.data.creditLeft
						this.customerName = res.data.data.customerName
					}
				})
			},
			resourceClick(){
				console.log('123')
				uni.navigateTo({
					url:'/pages/resource/resource'
				})
			},
			limitList() {
				uni.navigateTo({
					url: '/pages/apply-limit/apply-limit-list'
				});
			},
			rongziList() {
				uni.navigateTo({
					url: '/pages/financial-products/financing-apply-list'
				});
			},
			applyLimit() {
				uni.switchTab({
					url: '/pages/apply-limit/apply-limit'
				});
			},
			financingApply() {
				uni.navigateTo({
					url: '/pages/limit/limit'
				});
			},
			myLimit() {
				uni.navigateTo({
					url: '../limit/limit'
				});
			},
			closeDrawer() {
				this.$refs.showRight.close();
			},
			sysUser() {
				uni.navigateTo({
					url: '../user/menu'
				});
			},
			logout() {
				uni.removeStorageSync('token')
				uni.removeStorageSync('userInfo')
				uni.removeStorageSync('baseFormData')
				uni.navigateTo({
					url: '../login/login'
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #f9f9f9;
	}

	.cgtt {
		font-family: 'cgtt' !important;
		font-size: 16px;
		font-style: normal;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
	}

	%section {
		display: flex;
		justify-content: space-around;
		align-content: center;
		background: #fff;
		border-radius: 10upx;
	}
	%flex-center {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
	.order-section {
		@extend %section;
		padding: 30upx 0;

		.order-item {
			@extend %flex-center;
			width: 120upx;
			height: 120upx;
			border-radius: 10upx;
			font-size: 28rpx;
			color: #000000;

			image {
				height: 60rpx;
				width: 60rpx;
				margin-bottom: 20upx;
			}
		}
	}

	.nameBox {
		height: 200rpx;
		background: #3B5DE0;
	}

	.topBox {
		width: 100%;
		/* border: 1px solid #000000; */
		background-image: url('../../static/img/mine-top-img.png');
		background-size: 100% 100%;
	}

	.bottomtBox {
		width: 90%;
		margin: 0 auto;
		border-radius: 15rpx;
		background: #FFFFFF;
		margin-bottom: 20rpx;
	}
	
	.button_fix {
		width: 90%;
		margin: 0 auto;
		height: 70rpx;
		// margin: 0 auto;
		color: #FFFFFF;
		background: #2f5bf8;
		font-weight: bold;
		letter-spacing: 5rpx;
		font-size: 28rpx;
		line-height: 70rpx;
		margin-top: 100rpx;
	}
</style>